{%TEMPLATE->struct/head%}
{%TEMPLATE->struct/menu%}
<h2>All Access Groups ([[sizeof([[groups]])]])</h2>
{%TEMPLATE->struct/messages%}
<div class="card">
  <div class="table-responsive">
    <table class="table table-bordered">
      <tr>
        <th colspan="5" class="text-center">
          <a href="groups.php?new=true"><button class="btn btn-success">Create New Access Group</button></a>
        </th>
      </tr>
		  <tr>
			  <th>ID</th>
			  <th>Name</th>
			  <th># of Members</th>
			  <th># of Agents</th>
			  <th>Action</th>
		  </tr>
		  {{FOREACH group;[[groups]]}}
			  <tr>
				  <td>[[group.getId()]]</td>
				  <td>[[htmlentities([[group.getGroupName()]], ENT_QUOTES, "UTF-8")]]</td>
				  <td>[[users.getVal([[group.getId()]])]]</td>
				  <td>[[agents.getVal([[group.getId()]])]]</td>
          <td>
            <form class="float-right mx-1" action="groups.php" method="POST" onSubmit="if (!confirm('Really delete access group [[htmlentities([[group.getGroupName()]], ENT_QUOTES, 'UTF-8')]]?')) return false;">
              <input type="hidden" name="action" value="[[$DAccessGroupAction::DELETE_GROUP]]">
              <input type="hidden" name="csrf" value="[[csrf]]">
              <input type="hidden" name="groupId" value="[[group.getId()]]">
              <button type="submit" class='btn btn-danger' data-toggle="tooltip" data-placement="top" title="Delete"><i class="fas fa-trash" aria-hidden="true"></i></button>
            </form>
            <div class="float-right mx-1">
              <a class='btn btn-primary' href="groups.php?id=[[group.getId()]]" data-toggle="tooltip" data-placement="top" title="Edit"><i class="fas fa-edit" aria-hidden="true"></i></a>
            </div>
          </td>
			  </tr>
		  {{ENDFOREACH}}
	  </table>
  </div>
</div>
{%TEMPLATE->struct/foot%}
